package com.itdata.webservice.impl;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import com.itdata.entity.UserInfo;
import com.itdata.webservice.IUserServices;

/**   
 * @Title: UserTest.java 
 * @Package com.itdata.webservice.impl 
 * @Description: TODO 
 * @author 陈凯 chenkai-ds@petrochina.com.cn   
 * @date 2013-5-14 下午9:49:59 
 * @version V1.0   
 */

public class User {

	public static void main(String[] args) {  
        //创建WebService客户端代理工厂     
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();     
        //注册WebService接口     
        factory.setServiceClass(IUserServices.class);     
        //设置WebService地址     
        factory.setAddress("http://localhost:8090/userInfoServices");          
        IUserServices userServices = (IUserServices)factory.create();     
        System.out.println("invoke userinfo webservice...");  
        // 测试返回JavaBean对象的  
        UserInfo user = userServices.getUserInfo("vicky", 23);  
        System.out.println("UserName: "+user.getUserName());  
        System.out.println("UserAge : "+user.getUserAge());  
          
        System.exit(0);     
    }   
}
